package actionPattern.observer;

import java.util.ArrayList;
import java.util.List;

public class ConcreteSubject implements Subject{

    List<Observer> observerList = new ArrayList<>();

    @Override
    public void attach(Observer ob) {
        observerList.add(ob);
    }

    @Override
    public void dettach(Observer ob) {
        observerList.remove(ob);
    }

    @Override
    public void notifyAllOb(String message) {
        for(Observer ob : observerList) {
            ob.update(message);
        }
    }
}
